package com.mcxx.modules.system.service.read;

import com.mcxx.formulcount.param.FormulCountParam;
import com.mcxx.modules.system.dao.read.SalvationRuleReadDao;
import com.mcxx.modules.system.entity.AreaSalvationEntity;
import com.mcxx.modules.system.entity.SalvationRuleEntity;
import com.mcxx.modules.system.param.SalvationRuleParam;
import com.yinhai.ta404.core.restservice.requestbean.PageParam;
import com.yinhai.ta404.core.restservice.resultbean.Page;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service("salvationRuleReadService")
@TaTransactional(readOnly = true)
public class SalvationRuleReadService {

    @Resource
    private SalvationRuleReadDao salvationRuleReadDao;

    public List<SalvationRuleEntity> queryRuleCount(FormulCountParam param) {
        return salvationRuleReadDao.queryRuleCount(param);
    }


    public Page listSalvationRule(SalvationRuleParam param, PageParam pageParam) {
        salvationRuleReadDao.beginPager(pageParam);
        List<SalvationRuleEntity> rules = salvationRuleReadDao.listSalvationRule(param);
        return salvationRuleReadDao.endPager(rules);
    }


    public SalvationRuleEntity getById(String id) {
        return salvationRuleReadDao.getById(id);
    }


    public List<AreaSalvationEntity> getAreaSalivations(List<String> areaCodes, List<String> types){
        return salvationRuleReadDao.getAreaSalivations(areaCodes, types);
    }
}
